Week 6
Milestones
- Optimised the code and improved coding hygiene
- Made the code more readable
Learnings
Code Readability and Maintainability:
Code readability refers to the ease with which a developer can understand and work with the code. It is a fundamental aspect of coding hygiene because readable code is easier to maintain and extend. Here are some key techniques for achieving code readability:
Consistent Naming Conventions: Use descriptive and consistent names for variables, functions, classes, and other identifiers. This makes it easier to understand the purpose and usage of each component.
Modularization: Break down your code into smaller, reusable modules or functions. Each module should have a single responsibility, and the interactions between modules should be well-defined and documented.
Optimizing Code:
Code optimization involves improving the performance and efficiency of your code. This is particularly important for resource-intensive applications or when working on systems with limited processing power. Here are some optimization techniques:
Algorithmic Efficiency: Choose the most appropriate algorithms and data structures for your problem. Analyze the time and space complexity of your algorithms and aim for efficient solutions.
Profiling: Use profiling tools to identify performance bottlenecks in your code. Profilers can pinpoint which parts of your code consume the most CPU time or memory, helping you focus your optimization efforts.